package pl.edu.pk.adcampaignfacebook.controller;


import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IndexController
{
	private static Logger logger = Logger.getLogger(IndexController.class);
	@RequestMapping(value = "/index")
	public String index(HttpServletRequest request)
	{
		logger.info("returning index/index");
		
                /*Authentication auth = SecurityContextHolder.getContext().getAuthentication().getAuthorities();
                System.out.println("\n\n\n\n\n\n\n#######################");
                System.out.println(auth.getName());
                auth.get
                ArrayList*/  
		
                if (request.isUserInRole("ROLE_ADMIN"))
                {

                    return "index/indexAdm";
                }
                return "index/indexUs";
                
                //return "index/index";
	}
	
}
